﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="wfApplyDjack.aspx.cs" Inherits="msBsc.WebUi.wMall.Buyer.wfApplyDjack" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>成为地接客</title>
    <link href="/themes/wStyle1/css/sLayout.css" rel="stylesheet" />
    <link href="/themes/wStyle1/css/sHead.css" rel="stylesheet" />
    <link href="/themes/wStyle1/css/sFoot.css" rel="stylesheet" />
    <link href="/jqPlugin/laydate/skins/default/laydate.css" rel="stylesheet" />
    <link href="/jqPlugin/SelectSimu/css/base.css" rel="stylesheet" />
    <link href="/jqPlugin/hdfu/hdfu.css" rel="stylesheet" />
    <link href="/themes/wStyle1/css/Buyer/sApplyDjack.css" rel="stylesheet" />

    <link href="/themes/wStyle1/css/usermenu.css" rel="stylesheet" />
    <style type="text/css">
        .viewPC_head {
            border-bottom: none;
        }
    </style>
</head>
<body>
    <div class="wf_all" style="background-color: #fbfbfb;">
        <div id="divLoginInfo">
            <%=msBsc.WebUi.Code.QtHtmlGet.GetHeader("成为地接客") %>
        </div>
        <div class="wrap" style="background:no-repeat;">
            <div class="content" style="border-top: 3px solid #3398dc;">
                <div class="content-left">
                    <div class="left-updataImg">
                        <div class="uploadbox" data-count="0" data-value="Djack" style="display: block">
                            <div class="imgcontainer" id="imgHead">
                                <img src="/UpLoad/Djack/djack.jpg" id="ShowHeadPhoto" />
                            </div>
                        </div>
                    </div>
                </div>
                <div class="content-right">
                    <div class="tnavigation">
                        <a class="nav" href="/">首页</a>&gt;
				        <a class="nav" href="/wb_TouristInfo.htm">个人中心</a>&gt;
				        <a class="nav-on" href="#">成为地接客</a>
                    </div>
                    <div class="baseinfo">
                        <div class="baseinfo-title">
                            基本资料
                        </div>
                        <div class="baseinfo-content">

                            <!-- BEGIN 昵称 -->
                            <div class="items-wrap items-height-small itmes-border-bottom">
                                <div class="item-name">昵称:<span class="Notice-show">*</span></div>
                                <div class="item-info">
                                    <input type="text" id="txtNickName" class="text-middle" value="" />
                                    <span class="Notice Message2 Message-426"></span>
                                </div>

                            </div>
                            <!-- END 昵称 -->

                            <!-- BEGIN 姓名 -->
                            <div class="items-wrap items-height-small itmes-border-bottom">
                                <div class="item-name">姓名:<span class="Notice-show"></span></div>
                                <div class="item-info">
                                    <input type="text" id="txtChineseName" class="text-middle" value="" />
                                    <span class="Notice Message3 Message-427"></span>
                                </div>
                            </div>
                            <!-- END 姓名 -->

                            <!-- BEGIN 性别 -->
                            <div class="items-wrap items-height-small itmes-border-bottom">
                                <div class="item-name">性别:<span class="Notice-show"></span></div>
                                <div class="item-info">
                                    <div class="gender-wrap" style="width: 250px; float: left">
                                        <input type="radio" id="Male" name="Gender" value="M" checked="checked" />
                                        <label for="Male" class="label-gender">男</label>
                                        &nbsp;&nbsp;&nbsp;&nbsp;
                                <input type="radio" id="Female" name="Gender" value="F" />
                                        <label for="Female" class="label-gender" style="margin-right: 60px;">女</label>
                                    </div>
                                    <span class="Notice Message4 Message-1"></span>
                                </div>
                            </div>
                            <!-- END 性别 -->

                            <!-- BEGIN 身份证 -->
                            <div class="items-wrap items-height-small itmes-border-bottom">
                                <div class="item-name">证件号:<span class="Notice-show"></span></div>
                                <div class="item-info">
                                    <div id="card-select" class="select select-panal"></div>
                                    <input type="text" id="txtIdCard" class="text-middle" value="" />
                                    <span class="Notice Message5 Message-2"></span>
                                </div>
                            </div>
                            <!-- END 身份证 -->

                            <!-- BEGIN 所在地 -->
                            <div class="items-wrap items-height-small itmes-border-bottom">
                                <div class="item-name">所在地:<span class="Notice-show">*</span></div>
                                <div class="item-info">
                                    <div id="country" class="select select-panal"></div>
                                    <div id="city" class="select select-panal"></div>
                                    <div id="destion" class="select select-panal"></div>
                                    <span class="Notice Message6 Message-3"></span>
                                </div>
                            </div>
                            <!-- END 所在地 -->

                            <!-- BEGIN 服务类型 -->
                            <div class="items-wrap items-height-small itmes-border-bottom">
                                <div class="item-name">服务类型:<span class="Notice-show"></span></div>
                                <div class="item-info">
                                    <input type="radio" id="DriverWithGuide" name="ServiceType" value="1" checked="checked" />
                                    <label for="DriverWithGuide" class="label-gender">司机兼导游</label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                <input type="radio" id="DriverWithLead" name="ServiceType" value="2" />
                                    <label for="DriverWithLead" class="label-gender">司机兼向导</label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                <input type="radio" id="DriverAndGuide" name="ServiceType" value="3" />
                                    <label for="DriverAndGuide" class="label-gender">专职司机+专业导游</label>
                                    <span class="Notice Message7 Message-4"></span>
                                </div>
                            </div>
                            <!-- END 服务类型 -->

                            <!-- BEGIN 服务标签 -->
                            <div class="items-wrap items-height-small itmes-border-bottom">
                                <div class="item-name">服务标签:</div>
                                <div class="item-info">
                                    <input type="checkbox" id="FreeAdvisory" name="ServiceLabel" value="1" />
                                    <label for="FreeAdvisory" class="label-gender">免费旅游咨询</label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                <input type="checkbox" id="TravelPlan" name="ServiceLabel" value="2" />
                                    <label for="TravelPlan" class="label-gender">旅游定制</label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                <input type="checkbox" id="GuidService" name="ServiceLabel" value="3" />
                                    <label for="GuidService" class="label-gender">导游服务</label>
                                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                <input type="checkbox" id="LeadService" name="ServiceLabel" value="4" />
                                    <label for="LeadService" class="label-gender">向导服务</label>
                                </div>
                            </div>
                            <!-- END 服务标签 -->

                            <!-- BEGIN 自我简介 -->
                            <div class="items-wrap">
                                <div class="item-name">
                                    <p style="line-height: 35px;">自我简介</p>
                                    <p class="Notice Message8" style="line-height: 35px;"></p>
                                </div>
                                <div class="item-info">
                                    <textarea class="text-selfintroduce" id="tatSelfIntro" maxlength="250"></textarea>
                                </div>
                            </div>
                            <!-- END 自我简介 -->

                        </div>
                    </div>
                    <div class="conaction">
                        <div class="conaction-title">
                            联系方式
                        </div>
                        <div class="conaction-content">

                            <!-- BEGIN 手机 -->
                            <div class="items-wrap items-height-small itmes-border-bottom">
                                <div class="item-name">手机:<span class="Notice-show">*</span></div>
                                <div class="item-info">
                                    <input type="text" id="txtMobile" class="text-middle" value="" />
                                    <span class="Notice Message9 Message-7"></span>
                                </div>
                            </div>
                            <!-- END 手机 -->

                            <!-- BEGIN 固话 -->
                            <div class="items-wrap items-height-small itmes-border-bottom">
                                <div class="item-name">固话:</div>
                                <div class="item-info">
                                    <input type="text" id="txtPhoneTitle" class="text-middle" style="width: 60px" maxlength="4" value="" />
                                    - 
                                <input type="text" id="txtPhoneContent" class="text-middle" style="width: 165px" maxlength="8" value="" />
                                    <span class="Message-8" style="font-size: 12px; font-family: 微软雅黑; color: #f00"></span>
                                </div>
                            </div>
                            <!-- END 固话 -->

                            <!-- BEGIN QQ -->
                            <div class="items-wrap items-height-small itmes-border-bottom">
                                <div class="item-name">QQ:</div>
                                <div class="item-info">
                                    <input type="text" id="txtTencentQQ" class="text-middle" value="" />
                                    <span class="Notice Message10 Message-9"></span>
                                </div>
                            </div>
                            <!-- END QQ -->

                            <!-- BEGIN 邮箱 -->
                            <div class="items-wrap items-height-small itmes-border-bottom">
                                <div class="item-name">邮箱:<span class="Notice-show">*</span></div>
                                <div class="item-info">
                                    <input type="text" id="txtEmail" class="text-middle" value="" />
                                    <span class="Notice Message11 Message-10"></span>
                                </div>
                            </div>
                            <!-- END 邮箱 -->

                            <!-- BEGIN 微信 -->
                            <div class="items-wrap items-height-small itmes-border-bottom">
                                <div class="item-name">微信:</div>
                                <div class="item-info">
                                    <input type="text" id="txtWeChat" class="text-middle" value="" />
                                </div>
                            </div>
                            <!-- END 微信 -->
                        </div>
                    </div>
                    <div class="submit-button">
                        <span id="submit-button">立即申请</span>
                    </div>
                </div>
            </div>
            <div class="ui-mask"></div>
            <div id="altContent">
            </div>
        </div>
        <%=msBsc.WebUi.Code.QtHtmlGet.GetFloorHtml() %>
    </div>
    <!--start JS引用-->
    <script src="/jqPlugin/js/jquery-1.8.3.min.js"></script>
    <script src="/jqPlugin/js/jBase.js"></script>
    <script src="/jqPlugin/js/jBPage.js"></script>
    <script src="/jqPlugin/js/laytpl.js"></script>
    <script src="/jqPlugin/laydate/laydate.js"></script>
    <script src="/jqPlugin/SelectSimu/js/SelectSimu.js"></script>
    <script src="/themes/wStyle1/js/comm/VerifyJs.js"></script>
    <script src="/themes/wStyle1/js/comm/DateInfo.js"></script>
    <script src="/jqPlugin/hdfu/hdfu.js"></script>

    <script src="/jqPlugin/SelectSimu/js/SelectSimu.js"></script>
        <script src="/themes/wStyle1/js/comm/jsLayout.js"></script>
    <script type="text/javascript">
        //初始化证件选项
        (function () {
            $("#card-select").SelectSimu({
                width: 60,
                zIndex: 100,
                listNum: 3,
                listValue: ["1", "2", "3"],
                listOption: ["身份证", "护照", "驾照"],
                imgSrc: '/jqPlugin/SelectSimu/img/icon_down.png'
            });
        })()
        var parentsId = "00000000-0000-0000-0000-000000000000";
        var currentCountry = "";
        var currentCity = "";
        (function () {
            $('#country .selectList li').live('click', function () {
                var outerInnerId = this.getAttribute('data-value');
                if (currentCountry == outerInnerId) {
                    return;
                }
                currentCountry = outerInnerId;
                parentsId = outerInnerId;
                btnDo("getArea2");
            });
            $('#city .selectList li').live('click', function () {
                var provinceId = this.getAttribute('data-value');
                if (provinceId == currentCity) {
                    return;
                }
                currentCity = provinceId;
                parentsId = provinceId;
                btnDo("getArea3");
            });
            $("#submit-button").click(function () {
                applyDjack();
            });
        })();

        //实例化地区列表
        function setArea(input, width, zIndex, listNum, listValue, listOption, valueId, valueName) {
            $("#" + input).SelectSimu({
                width: width,
                zIndex: zIndex,
                listNum: listNum,
                listValue: listValue,
                listOption: listOption,
                imgSrc: '/jqPlugin/SelectSimu/img/icon_down.png'
            });
            $("#" + input + " input").val(valueId);
            $("#" + input + " span").text(valueName);
        }

        //更新地区下拉列表
        function updateSelet(inputId, data) {
            var selectValue = $("#" + inputId + " .selectList ul");
            selectValue.html("");
            for (var i = 0; i < data.rows.length; i++) {
                selectValue.append('<li data-value="' + data.rows[i].COUNTRY_CITY_ID + '">' + data.rows[i].COUNTRY_CITY_NME + '</li>');
            }
            if (data.rows.length > 0) {
                $("#" + inputId + " input").val(data.rows[0].COUNTRY_CITY_ID);
                $("#" + inputId + " span").text(data.rows[0].COUNTRY_CITY_NME);
            }
        }

        function btnDo(sEbtn) {
            GtGrid1Action = sEbtn;
            var opart = new jsonRow();
            if (sEbtn == "getUserInfo" || sEbtn == "getArea2" || sEbtn == "getArea3") {
                opart.AddCell("parentsId", parentsId);
                opart.AddCell("isAll", "false");
                opart.AddCell("ACTION", GtGrid1Action);
            }
            ajaxComm(opart);
        };

        btnDo("getUserInfo");

        //显示用户信息
        function showUserInfo(data) {
            $("#txtNickName").val(data.rows[0].CUSTOMER_NICK);
            $("input[name=Gender][value=" + data.rows[0].CUSTOMER_BASEINFO_GENDER + "]").attr("checked", "checked");
            //$("#txtChineseName").val(data.ChineseName);
            //$("#txtIdCard").val(data.CredibityID);
            $("#ShowHeadPhoto").attr("src", getUserPhoto(data.rows[0].CUSTOMER_DEFAULT_PIC, data.CUSTOMER_BASEINFO_GENDER) + " 115x115img.jpg");

            if (!IsNull(data.rows[0].CUSTOMER_BASEINFO_PHONE)) {
                var PhoneArray = data.rows[0].CUSTOMER_BASEINFO_PHONE.split('-');
                $("#txtPhoneTitle").val(PhoneArray[0]);
                $("#txtPhoneContent").val(PhoneArray[1]);
            }

            $("#txtMobile").val(data.rows[0].CUSTOMER_BASEINFO_MOBILE);
            //$("#tatSelfIntro").val(data.PersonIntro);
            $("#txtTencentQQ").val(data.rows[0].CUSTOMER_BASEINFO_QQ);
            $("#txtEmail").val(data.rows[0].CUSTOMER_BASEINFO_EMAIL);
            $("#txtWeChat").val(data.rows[0].CUSTOMER_WECHAT_NO);
        }

        //申请成为地接客
        function applyDjack() {
            debugger;
            var Gender = $.trim($("input[type=radio][name=Gender]:checked").val());
            var HeadPhoto = $.trim($(".imgcontainer img").attr("src"));
            if (!IsNull(HeadPhoto)) {
                var headArray = HeadPhoto.split('/');
                HeadPhoto = HeadPhoto.split(' ')[0];
            }
            if (IsNull(HeadPhoto)) {
                if (Gender == "M") {
                    userPhoto = "/UpLoad/Djack/man.jpg";
                } else if (Gender == "F") {
                    userPhoto = "/UpLoad/Djack/wman.jpg";
                } else {
                    userPhoto = "/UpLoad/Djack/djack.jpg"
                }
            }
            var NickName = $.trim($("#txtNickName").val());
            //验证昵称
            if (IsNull(NickName)) {
                alert("用户昵称不能为空");
                return;
            }
            else if (NickName.toUpperCase().indexOf("DJK") >= 0 || NickName.toUpperCase().indexOf("地接客") >= 0 || NickName.toUpperCase().indexOf("DIJIEKE") >= 0 || NickName.toUpperCase().indexOf("ADMIN") >= 0 || NickName.toUpperCase().indexOf("ADMINISTRATOR") >= 0 || !isEnLength(NickName, 4, 40)) {
                alert("用户昵称已占用")
                return;
            }

            var ChineseName = $.trim($("#txtChineseName").val());
            ////验证姓名
            //if (IsNull(ChineseName)) {
            //    alert("用户姓名不能为空");
            //    return;
            //} else 
            if (ChineseName.toUpperCase().indexOf("DJK") >= 0 || ChineseName.toUpperCase().indexOf("地接客") >= 0 || ChineseName.toUpperCase().indexOf("DIJIEKE") >= 0 || ChineseName.toUpperCase().indexOf("ADMIN") >= 0 || ChineseName.toUpperCase().indexOf("ADMINISTRATOR") >= 0 || ChineseName.length > 15) {
                alert("用户姓名不合法");
                return;
            }
            //获取地区信息
            var destionId = $.trim($("#destion input").val());
            var cityId = $.trim($("#city input").val());
            var countryId = $.trim($("#country input").val());
            if (IsNull(destionId) || IsNull(cityId) || IsNull(countryId)) {
                alert("请选择所在地");
                return;
            }
            var ServiceType = $.trim($("input[type=radio][name=ServiceType]:checked").val());
            //if (IsNull(ServiceType)) {
            //    alert("服务类型不能为空");
            //    return;
            //}
            var ServiceLabel = GetCheckedLabels();
            var SelfIntro = $.trim($("#tatSelfIntro").val());
            var MobilePhone = $.trim($("#txtMobile").val());
            if (IsNull(MobilePhone)) {
                alert("手机不能为空");
                return;
            }
            if (!isZero(MobilePhone)) {
                alert("请输入正确的手机号码");
                return;
            }
            var Phone = GetPhone();
            var TencentQQ = $.trim($("#txtTencentQQ").val());
            var Email = $.trim($("#txtEmail").val());
            if (IsNull(Email)) {
                alert("邮箱不能为空");
                return;
            }
            if (!IsEmail(Email)) {
                alert("邮箱格式不正确");
                return;
            }
            var WeChat = $.trim($("#txtWeChat").val());
            var cardType = $("#card-select input").val();
            var cardNumber = $.trim($("#txtIdCard").val());
            //if (IsNull(cardType) || IsNull(cardNumber)) {
            //    alert("请输入证件号");
            //    return;
            //}
            var opart = new jsonRow();
            opart.AddCell("ACTION", "applyDjack");
            opart.AddCell("HeadPhoto", HeadPhoto);
            opart.AddCell("NickName", NickName);
            opart.AddCell("ChineseName", ChineseName);
            opart.AddCell("Gender", Gender);
            opart.AddCell("destionId", destionId);
            opart.AddCell("cityId", cityId);
            opart.AddCell("countryId", countryId);
            opart.AddCell("ServiceType", ServiceType);
            opart.AddCell("ServiceLabel", ServiceLabel);
            opart.AddCell("SelfIntro", SelfIntro);
            opart.AddCell("MobilePhone", MobilePhone);
            opart.AddCell("Phone", Phone);
            opart.AddCell("TencentQQ", TencentQQ);
            opart.AddCell("Email", Email);
            opart.AddCell("WeChat", WeChat);
            opart.AddCell("cardType", cardType);
            opart.AddCell("cardNumber", cardNumber);
            ajaxComm(opart);
        }

        //得到用户电话
        function GetPhone() {
            if (($("#txtPhoneTitle").val() == null || $("#txtPhoneTitle").val() == "") && $("#txtPhoneContent").val() != null && $("#txtPhoneContent").val() != "") {
                return "abc";
            }

            if ($("#txtPhoneTitle").val() != null && $("#txtPhoneTitle").val() != "" && ($("#txtPhoneContent").val() == null || $("#txtPhoneContent").val() == "")) {
                return "abc";
            }

            if ($("#txtPhoneTitle").val() != null && $("#txtPhoneTitle").val() != "" && $("#txtPhoneContent").val() != null && $("#txtPhoneContent").val() != "") {
                return $.trim($("#txtPhoneTitle").val()) + "-" + $.trim($("#txtPhoneContent").val());
            } else {
                return "";
            }
        }

        //获取已选择的服务标签
        function GetCheckedLabels() {
            var ServiceLabel = "";
            var Checkeditems = $("input[type=checkbox][name=ServiceLabel]:checked");
            var CheckedLength = Checkeditems.length;
            $.each(Checkeditems, function (i, item) {
                if (i < CheckedLength - 1) {
                    ServiceLabel += $(this).val() + "|";
                }
                else {
                    ServiceLabel += $(this).val();
                }

            });
            return ServiceLabel;
        }

        function getUserPhoto(userPhoto, sex) {
            if (userPhoto != undefined && userPhoto != null && userPhoto != "") {
                return userPhoto;
            }
            if (sex == "M") {
                return "man.jpg";
            } else if (sex == "F") {
                return "wman.jpg";
            } else {
                return "djack.jpg";
            }
        }
    </script>
</body>
</html>
